<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/themes/icon.css"/>">
<script type="text/javascript" src="<c:url value="/js/jquery.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/easyui-lang-zh_CN.js"/>"></script>
<title>蒋路的部门页面</title>
</head>
<body>
<style>
 #department_kind,#department_Person,#department_btn{
 	margin-left:20px;
 	margin-top:13px;
 	float:left;
 }
 #department_{
	 border:1px solid #95B8E7;
 	 margin-top:5px;
 	 margin-bottom:5px;
 	 float:left;
	 background-color:#E0ECFF;
	 width:99.8%;
	 height:50px;
	 border-top-right-radius:15px;
	 border-top-left-radius:15px;
	 border-bottom-right-radius:15px;
	 border-bottom-left-radius:15px;
 }
</style>
<script type="text/javascript">
function QueryCourseByCollege() { 
	//获取当前时间
	var date = new Date();		
	var y = date.getFullYear();  
	var m = date.getMonth() + 1;  
	m = m < 10 ? '0' + m : m;  
	var d = date.getDate();  
	d = d < 10 ? ('0' + d) : d;  
	var needDate=y + '-' + m + '-' + d;  
	//判断
    var cprekindID = $('#index_cprekind').combobox('getValue');
    if (cprekindID == null || cprekindID == "") {  
    	$.messager.alert("温馨提示", "请选择科室");
    }  
    else {    	
    	$.ajax({
            type: "Post",
            url: "to_usefindALLTbscheduling",//根据部门编号查看排班表员工编号
            data: {padno:cprekindID},
            success: function (data) {
            	var staffNo=data;//根据部门编号查看员工信息
            	//var cmbSchoolYear = $('#index_cprePerson').combobox({  
                 //   url:'to_useFindNameTbstaff?staffNo='+ staffNo,  
                 //   editable: false,  
              //      method: 'get',  
              //      valueField:'staffNo',  
             //       textField: 'staffName',              
            //	});  
            }
        });           
    }  
} 

$(function(){
	var date = new Date();		
	var y = date.getFullYear();  
	var m = date.getMonth() + 1;  
	m = m < 10 ? '0' + m : m;  
	var d = date.getDate();  
	d = d < 10 ? ('0' + d) : d;  
	var needDate=y + '-' + m + '-' + d;  	
	$("#department_ExamineApplyref").linkbutton({
		onClick:function(){						
			$("#department_ExamineApplytab").datagrid({
				 url: 'to_ExamineApplypage'
			});
		}
	});
	$('#department_ExamineApplysearch').searchbox({
	    searcher:function(value,name){
	    	if(name=="姓名"){
	    		$.ajax({
	                type: "Post",
	                url: "to_nametoic",
	                data: {name:value},
	                success: function (data) {
	                	if(data==null || data==""){
	                		$.messager.alert("温馨提示", "没有该用户的任何信息！");	
	                	}else{
	                		$("#department_ExamineApplytab").datagrid({
					    		url:'icidtoexamineapply',
					    		queryParams: {
					    			ieId:data 
					    		}
					    	});
	                	}			                				           	
	                }
	            });
	    		
	    	}else if(name=="身份证号"){
	    		$.ajax({
	                type: "Post",
	                url: "to_iccardtoic",
	                data: {iIdentityCard:value},
	                success: function (data) {
	                	if(data==null || data==""){
	                		$.messager.alert("温馨提示", "没有该用户的任何信息！");	
	                	}else{
	                		$("#department_ExamineApplytab").datagrid({
					    		url:'icidtoexamineapply',
					    		queryParams: {
					    			ieId:data 
					    		}
					    	});
	                	}			                				           	
	                }
	            });
	    	}else{	
	            $("#department_ExamineApplytab").datagrid({
					 url:'icidtoexamineapply',
					 queryParams: {
					 	ieId:value 
					 }
				});			                				                				           				                			           
	    	}    	
	    	
	    }
	});
	$("#department_save").linkbutton({
		onClick : function() {
			var zhiPerson=$('#index_cprePerson').combobox("getValue");
			if(zhiPerson==null ||zhiPerson==""){
				$.messager.alert("温馨提示","文本框没有值哦！");
			}else{
				var zhikind=$('#index_cprekind').combobox('getText');
				$("#department_ExamineApplytab").datagrid({
					 url: 'to_ExamineApplypage_byOfficeName?officeName='+zhikind
				}); 			
				$('#department_begin_charge').linkbutton('enable');
			}
		}
	});
	
		$("#department_begin_charge").linkbutton({
			onClick:function(){
				var uic=$('#index_cprekind').combobox('getText');
				$('#department_ApplyWin').window({'title': "检查详情"});
				$("#department_ApplyWin").window('open');															
				$('#department_ApplyWin').panel({href:"tojl_PidToExamineApply?pid="+uic});															
			}
		});
		
	
});

</script>
  
         <div id="department_">																					
				<div id="department_kind">								                           
					 <select id="index_cprekind" class="easyui-combobox"  name="cpreIdkind" data-options="label:'种类:', editable:false,labelWidth:40,width:200,
							url:'to_usefindALLdepartment?king='+'检查化验',  
                            method:'get',  
                            valueField:'departmentNo',  
                            textField:'departmentName',  
                            panelHeight:'auto',                                       
							  onChange:function(){ 
                                 QueryCourseByCollege();  
                            } ">
					 </select>		
				</div>
												
				<div id="department_Person">
					 <select id="index_cprePerson" class="easyui-combobox"   data-options="label:'医师:',labelWidth:40,width:200,
							url:'',  
                            method:'get',  
                            valueField:'',  
                   			textField: '',  
                            panelHeight:'auto'                                       
							">
					</select>		
				</div>	
				<div id="department_btn">					
						<a id="department_save" class="easyui-linkbutton">确定</a>		     																		
						<a id="department_cancel" class="easyui-linkbutton">取消</a>						
				</div>																						
																									
		</div>
				<table id="department_ExamineApplytab" class="easyui-datagrid"
				data-options="
				fitColumns:true,
				fit:true,
				rownumbers: true,
			    url: 'to_ExamineApplypage',
				border:false ,
				pagination:true,
				toolbar: '#department_ExamineApply_btn',
				pageSize: 14,
				pageList:[14,28,42,56]
			">
			<thead>
				<tr>
					<th class="ident" data-options="field:'eId',checkbox:true">申请编号</th>
					<th class="ident" data-options="field:'ieId',width:10">IC卡号</th>
					<th class="ident" data-options="field:'eOffice',width:15,editor:'textbox'">科室</th>
					<th class="ident" data-options="field:'ePhysician',width:10">医师</th>
					<th class="ident" data-options="field:'cpreId',width:10">检查项目</th> 
					<th class="ident" data-options="field:'eDate',width:10,formatter:function(value){
                          var unixTimestamp = new Date(value);  
                          return unixTimestamp.toLocaleDateString();}">申请日期
                    </th> 
				</tr>
			</thead>
		</table>
			
		<div id="department_ExamineApply_btn">
			<a id="department_begin_charge"  class="easyui-linkbutton"
				data-options="iconCls:'icon-add',plain:true,disabled:true">开始检查</a>
			<a id="department_ExamineApplyref"class="easyui-linkbutton"
				data-options="iconCls:'icon-reload',plain:true">显示全部记录</a>
			<input id="department_ExamineApplysearch" class="easyui-searchbox" 
				data-options="menu:'#department_ExamineApplyee',width:220,prompt:'请输入。。。。'">
		</div>
		<div id="department_ExamineApplyee" style=" width:90px">
			<div date-options="name:'name'">卡号</div>
			<div date-options="name:'name'">姓名</div>
			<div date-options="name:'name'">身份证号</div>
		</div>
			
		<div id="department_ApplyWin" class="easyui-window" style="padding: 10px; line-height: 150%;" data-options="
				width: 800,
				height: 500,
				//href:'tojl_IdToExamineApply?ieId='+1,
				href:'',
				closed: true
			">	
		</div>	
		      	
</body>
</html>